Bootstrap Modal Windows in NodeJS - node.js

I am developing a dashboard website in NodeJS and MongoDB. In one of the page, I have to open an image in the modal window. Following is the code of that page.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tor Modal Check</title>
<link rel="stylesheet" href="css/style.default.css" type="text/css" />
<link rel="stylesheet" href="css/responsive-tables.css">
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/jquery-migrate-1.1.1.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script type="text/javascript" src="js/jquery-ui-1.9.2.min.js"></script>
<script type="text/javascript" src="js/modernizr.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.bxSlider.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/jquery.uniform.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/flot/jquery.flot.min.js"></script>
<script type="text/javascript" src="js/jquery.slimscroll.js"></script>
<script type="text/javascript" src="js/flot/jquery.flot.pie.min.js"></script>
<script type="text/javascript" src="js/flot/jquery.flot.resize.min.js"></script>
<script type="text/javascript" src="js/responsive-tables.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<style type="text/css">
body .modal {
width: 650px;
margin-left: -325px;
}
</style>
</head>
<body>
<div class="mainwrapper">
<div class="rightpanel">
<ul class="commentlist">
<% tor.forEach(function(t){ %>
<li>
<img src="images/screenshot/<%= t.screenshot %>" alt="" style="width: 60px;" class="pull-left" />
<div class="comment-info">
<h4><%= t.url %></h4>
<p><strong>Comments: </strong><%= t.comments %></p>
<div class="container">
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#<%= t.modalid %>">Show Screenshot</button>
<!-- Modal -->
<div class="modal fade" id="<%= t.modalid %>" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><%= t.url %></h4>
</div>
<div class="modal-body">
<img src="images/screenshot/<%= t.screenshot %>" height="100%" width="100%">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
<% }) %>
</ul>
</div>
</div>
</body>
The problem that I am facing is that not all "View Screenshot" are clickable. After digging a lot, I figure it's because of "rightpanel" div class.
/*** MAIN PANEL ***/
.rightpanel { margin-left: 260px; background: #f7f7f7; }
.rightpanel:after { clear: both; content: ''; display: block; }
If I remove margin-left: 260px; everything works as expected.
Any idea why this is happening and how to overcome it?
PS. This is not the complete code. Only the code that is significant for this question.
EDIT 1:
It works perfectly fine when i change margin-left: 260px to margin-left: 150px.

Bootstrap modals are already centered and have three sizes (300px for .modal-sm, 600px (default) and 900px for .modal-lg). But, if you need the width to be exactly 650px, you should set the width of .modal-dialog, not .modal. For example:
#media (min-width: 768px)
.modal-dialog {
width: 650px;
}

Related

CSS And Other Few Elements Not Working In Express Website. Node.js

I am making a discord bot with website, and i have defined css and other stuff in .html file but its still not showing when i go to the website.
res.status(200).sendFile(path.resolve(__dirname, "../../website/command.html"))
})
Thats how i require the html file.
The Html File:
<html lang="en-US">
<head>
<title>Commandli</title>
<link rel="icon" href="https://cdn.discordapp.com/avatars/746706292562853888/0b578635739cbd7e5b076e65f2c04a4c.png?size=2048">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./css/commands.css" />
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght#300;500;600;700&display=swap" rel="stylesheet">
</head>
<body>
<header class="header">
<img src="https://cdn.discordapp.com/avatars/"/> bot
<input class="menu-btn" type="checkbox" id="menu-btn" />
<label class="menu-icon" for="menu-btn"><span class="navicon"></span></label>
<ul class="menu">
<li>Home</li>
<li><a class="active" href="commands.html">Commands</a></li>
<li>About us</li>
<li>Contact us</li>
<li>Invite bot</li>
</ul>
</header>
<main>
<section class="tabs">
<div class="tab-header">
<div class="tablink tab-active" onclick="openCity(event,'Utility')">Utility</div>
<div class="tablink " onclick="openCity(event,'Fun')">Fun</div>
<div class="tablink" onclick="openCity(event,'Economy')">Economy</div>
<div class="tablink" onclick="openCity(event,'Info')">Info</div>
<div class="tablink" onclick="openCity(event,'Games')">Games</div>
<div class="tablink" onclick="openCity(event,'Misc')">Misc</div>
<div class="tablink" onclick="openCity(event,'All commands')">All commands</div>
</div>
<div style="margin-left:130px">
<div id="Utility" class="tab-content category" style="display:block">
<p><a>Utility commnads</a><br>Those commands help you with some things</p>
<p><a>=dungeon</a><br>Sends information about the current dungeon.</p>
<p><a>=help</a><br>Sends help!</p>
<p><a>=gamepedia</a><br>Search what you want on gamepedia</p>
<p><a>=welcome info</a><br>Information about the welcome system</p>
<p><a>Soon more!</a><br>Stay tuned!</p>
</div>
</div>
<script type="text/javascript" src="../js/commands.js"></script>
</section>
</main>
</body>
</html>
HTML file in bin = https://sourceb.in/DEA1wBlvs2
(Had to remove some code because it was huge)

Material design flex not working in browsers other than chrome

i am new to angular material design, my code of angular material design is working fine in google chrome but not currently working with Mozilla Firefox and Internet explorer. I know there is some error in my code while defining layout or flex. So i want to know what wrong i have written
<html lang="en" >
<head>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<script type="text/javascript">
angular.module('firstApplication', ['ngMaterial'])
.config(function($mdThemingProvider) {
$mdThemingProvider.theme('default')
.primaryPalette('light-green')
.accentPalette('red')
.warnPalette('green');
});
</script>
<style type="text/css">
.md-toolbar.md-default-theme:not(.md-menu-toolbar).md-warn, md-toolbar:not(.md-menu-toolbar).md-warn{
color: white;
}
</style>
</head>
<body ng-app="firstApplication" ng-cloak>
<md-toolbar class="md-primary md-hue-5">
<div class="md-toolbar-tools">
<h2 class="md-flex">My App</h2>
</div>
</md-toolbar>
<md-content class="md-padding">
<div layout="row" layout-align="center stretch">
<div layout="column" flex-sm="80" layout-align="center stretch" flex flex-gt-xs="40">
<md-card flex="60" class="md-padding" >
<div layout="column" layout-align="center center">
<img src="https://material.angularjs.org/1.0.1/img/icons/angular-logo.svg" flex >
<h4>Login to your account</h4>
</div>
<md-card-content>
<md-input-container class="md-icon-float md-block">
<!-- Use floating label instead of placeholder -->
<label>Username</label>
<md-icon class="name">
<i class="material-icons ">perm_identity</i>
</md-icon>
<input ng-model="user.name" type="text">
</md-input-container>
<md-input-container class="md-icon-float md-block">
<!-- Use floating label instead of placeholder -->
<label>Password</label>
<md-icon class="name">
<i class="material-icons">lock</i>
</md-icon>
<input ng-model="user.name" type="password">
</md-input-container>
<div layout="row" layout-xs="column">
<md-checkbox class="md-primary" flex-gt-xs="70" md-no-ink>
<span style="line-height:32px;">
Remember Me
</span>
</md-checkbox>
Forgot Password?
</div>
<div layout="row" layout-align="center center">
<md-button class="md-primary md-raised" flex="50"> Login </md-button>
</div>
</md-card-content>
</md-card>
</div>
</div>
</md-content>
</body>
</html>

Gridstack: Change space between items

Hopefully I'm just missing something simple, but there is a little too much space between the items ("grid-stack-item" divs). I would like a grid where the items are a little closer together. I was hoping maybe someone had a codepen or fiddle that showed how to decrease the space between the items (shrink the columns).
Relevant code:
<html>
<head>
<!--JQUERY-->
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js" integrity="sha256-xNjb53/rY+WmG+4L6tTl9m6PpqknWZvRt0rO1SRnJzw=" crossorigin="anonymous"></script>
<!--Bootstrap-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<!--Lodash-->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.13.1/lodash.js"></script>
<!--Gridstack-->
<script type="text/javascript" src='//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.5/gridstack.min.js'></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.5/gridstack.min.css" />
<style>
.grid-stack-item{background-color: #00CED1;}
.red {border: 1px solid red;}
.blue {border: 3px solid blue;}
.red-dash {border: 3px dashed red;}
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="col-md-12">
<div class="grid-stack" style="margin-top: 20px;">
<div class="grid-stack-item"
data-gs-x="0" data-gs-y="0"
data-gs-width="1" data-gs-height="1">
<div class="grid-stack-item-content">BOX 1</div>
</div>
<div class="grid-stack-item"
data-gs-x="2" data-gs-y="0"
data-gs-width="1" data-gs-height="1">
<div class="grid-stack-item-content">BOX 2</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
var options = {
cellHeight: 80,
width: 4
};
$('.grid-stack').gridstack(options);
});
</script>
<!-- Scripts -->
</body>
</html>
You need to make the data-gs-x attribute of the second grid-stack-item 1 instead of 2 as the width of each grid-stack-item is only 1. At the moment you have a empty space there because you've told it to leave it empty.
Well this is a four years old quetions. But you can change that gap by adding the margin parameter to the grid options. Default margin value is 10.I can be an integer (px) or a string (ex: '2em', '20px', '2rem')
var options = {
cellHeight: 80,
width: 4,
margin: 5
};
source document

Watir-Webdriver Can't access a element with id and class

I am having a trouble trying to access a nested div that has id and class, I don't know why but I only can see his parent.
This is the HTML code:
<html xml: lang="en" xmlns="http://www.w3.org/1999/xhtml" webdriver="true">
<head id="ctl00_Head1"></head>
<body onunload="deshabilitaHistoria();" onload="deshabilitaHistoria();">
<form id="aspnetForm" action="ConsultaReceptor.aspx" method="post">
<div class="aspNetHidden"></div>
<script type="text/javascript">
//<![CDATA[ var theForm = document.forms['aspnetF…
</script>
<script type="text/javascript" src="/WebResource.axd?d=w3hP2KgSK0z5QKKeYrfjOjGIUO1WTymINPb1PJaT2…AjAREgWLQ_9gOp19BJLQL03iwEhxTK_VlYMMLk1&t=635757173565717094"></script>
<script type="text/javascript" src="/ScriptResource.axd?d=JZxa8gqDBBrScXZMeyf5kBYrESwOlB3UypK5wa…sdGfW92qpYAba8RsL1xfZ_4qsx20HZ3gnR8gWNG81&t=ffffffff805766b3"></script>
<script type="text/javascript" src="/ScriptResource.axd?d=Z6KcuJ_OzxT6nvHmSunXcYkoXPPYk2iZ6iqqza…Mhq8K8bd09EWTYt8d-AfoMh3rrp75DWb5vMAI1wb0&t=ffffffff805766b3"></script>
<script type="text/javascript">
//<![CDATA[ var PageMethods = function() { PageMe…
</script>
<div class="aspNetHidden"></div>
<script type="text/javascript">
//<![CDATA[ Sys.WebForms.PageRequestManager._init…
</script>
<div id="cuerpo_principal">
<div id="encabezado"></div>
<div id="menucontainer"></div>
<div id="cuerpo" style="margin-top: 30px">
<h2 class="subtitle">
Consultar Facturas Recibidas
</h2>
<span></span>
<br></br>
<br></br>
<div id="ctl00_MainContent_PnlConsulta" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_MainContent_BtnBusqueda')">
<div id="ctl00_MainContent_UpnlBusqueda"></div>
<div id="ctl00_MainContent_UpnlResultados">
<div id="ctl00_MainContent_PnlResultados" class="pnlResultados" style="height:auto;display:inline;">
<div id="DivContenedor" class="resultados" style="width: 900px; margin-left: 40px; overflow-x: scroll; height: auto; float: left">
<div id="ContenedorDinamico" style="margin-left: 0px;">
<table class="encabezadoresultado"></table>
<div id="DivPaginas" style="height: auto;">
<div id="masivapg0" class="pgActual"></div>
The div that i am trying to access is
div id="masivapg0" class="pgActual"
I am trying to access the element by the following code, however i always get a false result:
print browser.form(id: 'aspnetForm').div(id: 'cuerpo_principal').div(id: 'cuerpo').div(id: 'ctl00_MainContent_PnlConsulta').div(id: 'ctl00_MainContent_UpnlResultados').div(id: 'ctl00_MainContent_PnlResultados').div(id: 'DivContenedor').div(id: 'ContenedorDinamico').div(id: 'DivPaginas').div(id: 'masivapg0').exist?
But if i search for his parent i always get a true response:
print browser.form(id: 'aspnetForm').div(id: 'cuerpo_principal').div(id: 'cuerpo').div(id: 'ctl00_MainContent_PnlConsulta').div(id: 'ctl00_MainContent_UpnlResultados').div(id: 'ctl00_MainContent_PnlResultados').div(id: 'DivContenedor').div(id: 'ContenedorDinamico').div(id: 'DivPaginas').exist?
Any idea of why could this be happening?
your help is appreciated!
I loaded your html into a file and ran it in watir and, while the browser didn't display anything likely due to the incomplete html code, it didn't have any problem returning true like so:
browser.div(:id => "masivapg0").exists?
#=> true
id tags are supposed to be unique, so you shouldn't have to provide any more selectors than this...

jQuery easyui layout centering - one region overlaying another

I am trying to centre a button inside a region by using jQuery easyui layout feature:
<!DOCTYPE html>
<html style="height: 90%;">
<head>
<meta charset="UTF-8">
<title>The Analytic Platform - Home Page</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<link rel="stylesheet" type="text/css" href="demo.css">
<script type="text/javascript" src="../jquery.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<style>
.middle {
height:30%;
}
.topandbelow {
height:40%;
}
</style>
</head>
<body style="height: 90%;">
<h2>The Analytic Platform</h2>
<p>Easy analytics for everyone!</p>
<div id="p" class="easyui-panel" title="Step 1: Load data for analysis" style="width:100%;height:100%;padding:10px;">
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%">
<div data-options="region:'west',split:false,border:true" style="width:40%;" title="Get data from Excel file">
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%">
<div data-options="region:'centre',split:false,border:true" style="width:100%;">
<a href="ExcelUpload.html" class="easyui-linkbutton" >Upload Excel file</a>
</div>
</div>
</div>
<div data-options="region:'east',split:false,border:true" style="width:40%;height:100%" title="Get data from database">
<div class="easyui-layout" data-options="fit:false" style="width:100%;height:100%">
<div data-options="region:'north',split:false,border:true" class="topandbelow"></div>
<div data-options="region:'centre',split:false,border:true" class="middle">
Define Database Connection
</div>
<div data-options="region:'south',split:false,border:true" class="topandbelow"></div>
</div>
</div>
</div>
</div>
</body>
</html>
The "east" region is not displaying its nested "centre" region with the "north" region overlaying it.
What could be wrong in here?

Resources