Converse embedded css issues - javascript

and greetings. I'm trying to get converse to work in embedded mode, so there is a 'full screen' version that doesn't take up the entire page. I'm having issues, where the converse control box grows outside of the area I've assigned, but there is no scroll bar to view it.
I've tried a lot of things, setting dimensions, width and height, changing dimensions, and it doesn't fix the issue. I was wondering if someone could tell me what I'm doing wrong. The webpage code is listed below.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<!-- Custom fonts for this template-->
<link href="/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="/css/sb-admin-2.min.css" rel="stylesheet">
<link href="/css/PEC_global.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/9.0.0/dist/converse.css">
<script src="https://cdn.conversejs.org/9.0.0/dist/converse.js" charset="utf-8"></script>
<!--script src="/vendor/converse/dist/converse.js"></script-->
<script src="/vendor/jquery/jquery.min.js"></script>
<script src="https://cdn.conversejs.org/3rdparty/libsignal-protocol.min.js"></script>
<style>
.converse-container {
height: 80vh;
}
</style>
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper" style="height:100vh;">
<!-- Sidebar -->
<?php require($_SERVER["DOCUMENT_ROOT"] . '/navBar.php'); ?>
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<div class="row">
<div class="col-9">
<div class="converse-container">
<converse-root></converse-root>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Logout Modal-->
<!-- Bootstrap core JavaScript-->
<script src="/vendor/jquery/jquery.min.js"></script>
<script src="/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="/js/sb-admin-2.min.js"></script>
<!-- custom JS for PEC -->
<script src="/js/PEC.js"></script>
</body>
<script>
var tabulatorTable = null;
$(document).ready(function() {
converse.initialize({
default_domain: "XXXXXXX",
bosh_service_url: 'XXXXXXXXX',
view_mode: 'embedded',
message_archiving: 'always',
auto_login: true,
auto_reconnect: true,
credentials_url: 'XXXXXX',
clear_cache_on_logout: true,
notify_all_room_messages: true,
play_sounds: true,
allow_contact_removal: false,
//allow_logout: false,
allow_muc_invitations: false,
allow_registration: false,
allow_contact_requests: false,
send_chat_state_notifications: false,
//blacklisted_plugins: ['converse-fullscreen'],
});
});
</script>

Related

Read data from index.html into logic.js

I have an index.html file that is getting data from app.py (pulling from MongoDB) using render_template and I am attempting to read the data loaded in the index.html into my logic.js so I can create a leaflet map. However, it seems that the data is not loading in my logic.js. Any thoughts?
Here is my index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Visualization</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet#1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin="" />
<!-- Leaflet JavaScript code -->
<script src="https://unpkg.com/leaflet#1.6.0/dist/leaflet.js"
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin=""></script>
<!-- Our CSS -->
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
</head>
<body>
<div id="map"></div>
<div class="container text-center">
<h1 class="p-3 mb-2 bg-secondary text-white">Map Visualization</h1>
</div>
<!-- confirm that data is loaded -->
<!-- {% for i in html_results %}
<h5>{{i}}</h5>
{%endfor%} -->
<script>
let html_results = JSON.parse("{{html_results | tojson | safe}}")
</script>
<script src="{{url_for('static', filename='/js/logic.js')}}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
</body>
</html>

JavaScript is not Running/Working/Loading on my website

If I use the script tag or link the file the js does not Run if it is a problem with the js here is my code.
$("img").on("contextmenu", function (e) {
return false;
});
$("img").mousedown(function (e) {
e.preventDefault()
});
const toggle = document.querySelector(".toggle");
const menu = document.querySelector(".menu");
/* Toggle mobile menu */
function toggleMenu() {
if (menu.classList.contains("active")) {
menu.classList.remove("active");
toggle.querySelector("a").innerHTML = "<i class='fas fa-bars'></i>";
} else {
menu.classList.add("active");
toggle.querySelector("a").innerHTML = "<i class='fas fa-times'></i>";
}
}
/* Event Listeners */
toggle.addEventListener("click", toggleMenu, false);
for (let item of items) {
if (item.querySelector(".submenu")) {
item.addEventListener("click", toggleItem, false);
}
item.addEventListener("keypress", toggleItem, false);
}
document.addEventListener("click", closeSubmenu, false);
I have the disabled cache to and I have reloaded and Copied the exact file name to my script tag that links the javascript.
And my HTML. Because it might be a problem here.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- basic -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- mobile metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<!-- site metas -->
<title>Upright Code - Hire Me Coder</title>
<meta name="description" content="Hire Me, I am a Coder, Web and coding tutorials" />
<meta name="keywords"
content="HTML,CSS,JavaScript, Hire Coder, Hire, Code, Coder, Coding Lessons, Lessons on HTML, Lessons on CSS" />
<meta name="author" content="--------" />
<!-- Awsome Font -->
<script src="https://kit.fontawesome.com/82298f2f89.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Javascript js -->
<script src="js\Main_Javascript.js" defer></script>
<!-- style css -->
<link rel="stylesheet" href="css/style.css">
<!-- fevicon -->
<link rel="icon" href="images/logo.png" type="image/png" />
<!-- Tweaks for older IEs-->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css"
media="screen">
</head>
<body>
<!--
<script>
window.location.replace("https://uprightcode.com/comming-soon");
</script>
-->
<nav>
<ul class="menu">
<li class="logo">Upright Code</li>
<li class="item">Home</li>
<li class="item">About</li>
<li class="item">Plans</li>
<li class="item">Lessons
</li>
<li class="toggle"><i class="fas fa-bars"></i></li>
</ul>
</nav>
<section class="hero">
<div class="hero-content">
<h1 class="hero-title">
Discover the World
</h1>
<h2 class="hero-subtitle">
We offer the best adventure holidays and tailor-made trips!
</h2>
<button type="button" class="hero-button" onclick="location.href='tours.html'">
Search for tours »
</button>
</div>
</section>
<img src="images/garfield-movie.webp">
</body>
</html>
<script>
setTimeout(function () { console.clear(); }, 10000);
</script>
I put where the js is my full path to that is
/uprightcode/js/Main_Javascript.js
You need to load jquery. Add this in HTML
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

Angular Module Config Breaks When I Add App Name

I'm setting up a config for the 'angular-oauth2' module, and when I run
angular.module('', ['angular-oauth2'])
.config(['OAuthProvider', function(OAuthProvider) {
OAuthProvider.configure({
baseUrl: '/api/v1',
clientId: null,
clientSecret: null // optional
});
}]);
my server runs fine and all is well, when I add the name of the app though ('fuse') it breaks:
angular.module('fuse', ['angular-oauth2'])
.config(['OAuthProvider', function(OAuthProvider) {
OAuthProvider.configure({
baseUrl: '/api/v1',
clientId: null,
clientSecret: null // optional
});
}]);
And I get this error in the console:
angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=fuse&p1=Error%3A%20…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.5.5%2Fangular.min.js%3A43%3A246)
I've looked in the html and low and behold the name of the app is 'fuse', so what's up with this error?
<html>
<head>
<base href="/app/">
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title></title>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.2/angular-material.min.css">
<link rel="stylesheet" href="build/fuse.css" >
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angular_material/1.0.7/angular-material.min.js"></script>
<script src="build/fuse.js"></script>
</head>
<!--[if lt IE 10]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
your browser</a> to improve your experience.</p>
<![endif]-->
<body ng-app="fuse" md-theme="default" md-theme-watch
class="{{state.current.bodyClass || ''}}">
<!-- SPLASH SCREEN -->
<ms-splash-screen id="splash-screen" >
<div class="center">
<div class="logo">
<span></span>
</div>
<!-- Material Design Spinner -->
<div class="spinner-wrapper">
<div class="spinner">
<div class="inner">
<div class="gap"></div>
<div class="left">
<div class="half-circle"></div>
</div>
<div class="right">
<div class="half-circle"></div>
</div>
</div>
</div>
</div>
<!-- / Material Design Spinner -->
</div>
</ms-splash-screen>
<!-- / SPLASH SCREEN -->
<div id="main" class="animate-slide-up scrollable" ui-view="main" layout="column" ></div>
<floating-app-version></floating-app-version>
<!--<link href="build/styles.css" type="text/css" rel="stylesheet" />-->
<script src="build/common.js"></script>
<script src="build/vendor.js"></script>
<script src="/assets/app_config.js"></script>
<link rel="stylesheet" href="build/app.css" lazyload>
<script src="build/app.js"></script>
<script src="build/style.js"></script>
</body>
</html>

Timed FadeOut not working

I've been wanting to make an image fadeout after a period of time. I've looked through the same topics found here in Stackoverflow but mine doesn't want to work.
If anyone could take a quick peek at my code I would be very grateful please?
The image I would like to fade is:
My code:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>ACC BIC - Business Industry Description</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/png" href="images/favicon.png">
</head>
<body>
<!-- Primary Page Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="container">
<div class="row">
<div class="twelve columns">
<!-- Bottom bar navigation -->
<div class="btn btn-two">
<span class="btn-two--link"></span>
<span class="btn-three--link"></span>
<span class="btn-four--link"></span>
<img id="myImage" class="email-sent-img" src="images/email-link-sent.png" alt="">
<script>
$(window).load(function(){
setTimeout(function(){ $('#myImage').fadeOut() }, 5000);
});
</script>
</div>
<!-- Background image -->
<img class="proto-img" src="images/cards-view-selected.png" alt="">
</div>
</div>
</div>
<!-- End Document
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
</body>
</html>
Have you given your page a link to the jQuery code. It doesn't look like you have, so the computer can't understand the
$(window).load() event or the $("#myImage").fadeOut() method. To fix this just add this line of code into the head section of your page-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
If you would prefer to use a later version of jQuery, you can look on the jQuery website for more information.
If this still doesn't work, try replacing the $("myImage").fadeOut() with $("#myImage").fadeTo("slow",0)
Hope this helps.
try
$(window).on('load', function () {
setTimeout(function () {
$("#image").fadeOut("slow", function () { // Instead of Slow you could add 5000 (5s)
// fade out complete if you need to run another event
});
}, 5000); // fade out starts after 5s
});

Summernote and Codemirror not working?

I am currently trying to make codemirror and summernote work, I have followed a online tutorial but there seems to be a problem with the file dependencies. My code is. I have taken the online file urls from summernote's example page, so it should work.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Code editor</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/font-awesome.css" rel="stylesheet"/>
<link href="css/summernote.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.min.css" />
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/monokai.min.css">
<!-- Add custom CSS here -->
</head>
<body>
<div class="row">
<br />
<div class="container">
<div class="col-lg-12">
<form action="">
<div class="form-group">
<label for="">Descriptions</label>
<textarea id="description" rows="10" class="form-control"></textarea>
</div>
</form>
</div>
</div>
</div>
<!-- /.end Footer -->
<!-- /.end container -->
<!-- JavaScript -->
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/summernote.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/mode/xml/xml.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/formatting.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#description').summernote({
height: 400,
codemirror: {
theme:'monokai'
}
});
});
</script>
</body>
</html>
Any help would be appreciated.... thanks
Refer the following code snippet, it's working perfectly fine for me.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>summernote</title>
<!-- include jquery -->
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<!-- include libraries BS3 -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
<script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
<!-- include codemirror (codemirror.css, codemirror.js, xml.js, formatting.js)-->
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.min.css" />
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/blackboard.min.css">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/monokai.min.css">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/mode/xml/xml.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/formatting.min.js"></script>
<!-- include summernote -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.6.1/summernote.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.6.1/summernote.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.summernote').summernote({
height: 200,
tabsize: 2,
codemirror: {
theme: 'monokai'
}
});
});
</script>
</head>
<body>
<textarea class="summernote"><p>Seasons <b>coming up</b></p></textarea>
</body>
</html>
Then point the cdn urls to the local file system url where the files are being located.
Use prettifyHtml: false to disable summernote formatting your code
$scope.summernoteOptions = {
height: 690,
focus: true,
prettifyHtml: false,
codemirror: {
theme: 'default',
mode: "text/html",
lineNumbers: true,
tabMode: 'indent'
}
};

Categories