How to create a spoiler feature inside a Moodle course (HTML)? - moodle

We create Moodle courses with PHP and the Moodle libraries.
The content comes from our users.
Some users create spoilers (DIVs to be clicked and then they reveal the content).
How could such a spoiler be created in Moodle?
Can Javascript and CSS be implemented directly into the HTML of a course? – It seems so!

You can basically add javascript and CSS to an HTML element:
$output = '<div style="cursor: pointer; background-color: yellow; color: transparent; opacity: 1;" onclick="javascript:this.style.color = \'#000\';this.style.backgroundColor = \'white\';">This is the spoiler content.</div>';
Then it works as a spoiler.

Related

It is posible to load customise HTML view into webView in swift?

suppose I am loading url into webView and it looks like:
But I want to remove some unwanted thing from this url like:
I searched a lot on internet but nothing helpful found.but I think that I have to remove some of tag from HTML view before it's load into webView. but I don't know how to do this.
Is it possible and if yes then how can I perform this action?
Please help me for this.
I have found the solution for my question and for that THIS tutorial helps me a lot.
as shown into this tutorial here is the step by step example for load a customised HTML View into webView.
A Web View From a String:
There are several ways to use a web view. Before attributed strings, this was the only way to get formatted text. The developer would write a string of text in HTML and send it to a UIWebview using the method loadHTMLString. Change the viewDidLoad method to this:
overridefuncviewDidLoad() {
super.viewDidLoad()
letmyHTMLString:String! = "<h1>Hello Pizza!</h1>"
myWebView.loadHTMLString(myHTMLString, baseURL: nil)
}
Line 3 makes a optional string, since the loadHTMString method requires one. Line 4 loads the string, and has a second parameter baseURL, which sets the base URL path for the HTML. Usually we set this to nil but if you had files you wanted to load like images or a style sheet, this would give the default path for the files.
Build and run:
That was pretty boring, so let’s add some more HTML code, replace the string with this, all without a page break.
letmyHTMLString:String! = "<h1 style=\"font-family: Helvetica\">Hello Pizza</h1><p>Tap the buttons above to see <strong>some cool stuff</strong> with <code>UIWebView</code><p><img src=\"https://apppie.files.wordpress.com/2014/09/photo-sep-14-7-40-59-pm_small1.jpg\">"
Youll notice a few places where we used the Quote escape sequence \". WE need to add quotes in a few pplaces and a backslash followed by a quote allows us to do so within a string. Build and Run. That is a little better:
A Web View and CSS From Files:
Trying to make something formatted from a string is not easy. Our work would be easier if we had the HTML in a separate file. Even better would be an external style sheet. Tap Command-N on the keyboard or File>New>File… from the drop-down menu to make a new file. Make a blank file by going to Other under iOS and Empty.
Click next and then name the file myHTML.html. Save the file. In the blank file add the following code:
<!--<DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!-- Based on lesson from http://www.w3.org/Style/Examples/011/firstcss -->Hello Pizza Home
<!-- Site navigation menu -->
<div class="navbar">
Home
Toppings
Crust
Ovens
</div>
<div class="content">
<!-- Main content -->
<h1>Hello Pizza!</h1>
This is a site for the love of all things pizza!
But we are not just pizza, we are with anything on a flatbread. So look around and you will find naan, flatbreads, pitas and tortilla related stuff too!!!
If that is not enough, check our sister site Hello Pie
<img src="https://apppie.files.wordpress.com/2014/09/photo-sep-14-7-40-59-pm_small1.jpg" alt="" />
<!-- Sign and date the page, it's only polite! -->
</div>
<address>Made 27 October 2012
by makeapppie.com.</address>
Back in the ViewController.swift file change the helloPizza method to this:
#IBAction func helloPizza(sender: UIBarButtonItem) {
let myURL = NSBundle.mainBundle().URLForResource("myHtml", withExtension: "html")
let requestObj = NSURLRequest(URL: myURL!)
myWebView.loadRequest(requestObj)
}
Line 2 creates a url for myHTML.html from what is called the main bundle. The main bundle is the directory we place all of our code files in XCode for a specific project. The main bundle changes location depending on the device. Instead of giving a literal path, we use this relative indicator. Line 3 creates an NSURLRequest, an object we feed into the loadRequest method in line 4. The loadRequest loads the HTML code into the UIWebView. Build and run this. Click the Pizza button and you get this:
This view is not that pretty, but we can add some CSS to clean it up a bit. Create another blank file as you did before, named myCSS.css and add the following to the new file:
body {
color: #eeeeee;
background: #a0a088;
font-family:Helvetica}
h1 {
color: #dd1111;
font-family:Chalkduster;
font-size: 18pt}
a{
font-family:Helvetica;
font-weight: bold;
color: #ffffaa;
text-decoration:none;
padding-left: 5px;
}
img{
padding-left:0;
max-width: 90%;
max-height: 90%;
box-shadow: 3px 3px 3px 0px #202020
}
.navbar {
background-color: #000000;
color: white;
position: absolute;
top: 0em;
left: 0em;
width: 100% }
.content{
padding-left: 1em;
padding-top: 1em;
}
The HTML code in myHTML.Html assumes that the baseURL is the bundle. Build and run and we get a better formatted web view:
Now with this example I can copy the page source from the browser and then I can paste that HTML code into my HTML file and I can make changes like I can remove unwanted tag from that HTML code and later I can load this HTML into webView.

Difficult to increase the profile text in Moodle

I'm having trouble finding which file to change the css in Moodle tool. In pagia the "view profile", the data is cut by "..." I would vizualisar throughout.
Follow the link to the image:
https://www.dropbox.com/s/ewzdf4mj4vwfmcc/sesi.JPG
Right click on it and press the INSPECT BUTTON in Chrome. You will see a panel that says wich file is the one been used.
In moodle, There is chance to come mostly css from selected theme.
If the css is not coming from selected theme then it may from standard theme or from particular module.
The css is put into one large file for performance. To switch this off, add this line to config.php
$CFG->themedesignermode = true;
Remove the line or set it to false after you have finished because it will make the site verrrry slow...
http://docs.moodle.org/dev/Creating_a_theme#Theme_designer_mode
Refresh the profile page and now you can use inspect element in Chrome, it should show the original css file.
It seems to be this file /theme/canvas/style/core.css
Around lines 288 to 296 (In Moodle 2.5.4)
.userprofile dl dt {
padding-left: 0;
font-weight: bold;
display: inline-block;
padding-right: 2%;
min-width: 100px;
width: 15%;
clear: both;
}
So edit this file in your theme
/theme/yourthemename/style/core.css
And add this to override the default min-width.
.userprofile dl dt {
min-width: 120px;
}
Refresh the profile page and it should display okay. 120px seems to be minimum for "Endereço de email" to be displayed in full.
Don't forget to remove this or set it to false after you have finished - config.php
$CFG->themedesignermode = false;

I have installed "share this" to my blog and when the I click the facebook like button only a part of it shows up on screen. How do I fix this?

I emailed support and they replied by saying to add this code to my css.
**span.st_fblike_hcount span div.fb-like span iframe#f249dba5d33c086.fb_ltr
{
height: 234px !important;
max-width: 634% !important;
}**
I am new to programming and do not know where exactly I should add this code. Can some one please instruct me on how to correct this problem.
My url My Blog
Thanks
It looks as though you need to go into the plugin folder and modify the CSS file. In the sharthis folder is a file called sharthis.css
Open the file in a text editor and add the following code that they gave you.
span.st_fblike_hcount span div.fb-like span iframe#f249dba5d33c086.fb_ltr
{
height: 234px !important;
max-width: 634% !important;
}
Save and refresh the page and it should work

Fancybox 2 - Include a new Div into Image?

How can I insert a new div (not in .js) into fancybox (when fancybox - image is open)? Like this:
I'm also try to make a div css to fit that description :)) still with no avail. I suck at css styling, will get back on this one when i figured it out. my theory is that it should be a div within a div within the div if you get what i mean :))
!!!!!!!!
UPDATE I tried messing around the css and this is what i got (I'm using 1.3.4v for simplicity's sake in my part) and for reference, these images and codes I used are found in the 1.3.4 demo packege from fancybox.net
If I didn't explain my code well, it just means I'm still working on it so I just hope you get why it is vague, but the point is it's doable and you only need to work out the css file. I hope someone has a nicer looking code
Output:
1.I all of these from jquery.fancybox-1.3.4.css
just change these 1 2 3 and mess around with example7 there in the demo
#fancybox-outer {
position: relative;
width: 100%;
height: 100%;
background: #fff;
padding-right:50%; /*this part extends the right side of the photo so it would look like thet're on the same page*/
}
2.This re-positions the original title to the upper right part of the image
.fancybox-title-inside {
padding-bottom: 10px;
text-align: left;
color: #333;
position: absolute;
top:0;
left:65%;
border:1px solid black;/*for you to see how large the div is*/
height:100%;
}
3.My new RED div where I will be
div.fancycontent{ /*saviour do word wrap here*/
border:1px solid black;
padding:2px;
color: #333;
background: #FF0000;
width:50%;
height: 100px;
}
I tried using fancybox in one of my projects but had to revert back to implementing my own popup's using the DIV elements. Its pretty easy to create your own popups instead of using fancybox or facebox if you know a bit of JQuery try to have a look at these links. You can customize your div tags to contain what ever you need.
output
source
In your fancybox JS, set the type to iframe:
$(document).ready(function() {
$('.callout').fancybox({
type: 'iframe',
width: '640px',
height: '480px',
});
});
Then you can open up anything you want in the fancybox by simply applying the class to your link:
<a class="callout" href="{path}">{link}</a>
If you have issues with the iframe display, you might try adding a secondary class to tell fancybox what type of content you are linking to (this is a new convention introduced in the latest version, so I don't know if I'd recommend using it by default):
<a class="callout callout.iframe" href="{path}">{link}</a>
Hope that helps!
ty
It just happened that I created this fancybox "a la" facebook demo that looks pretty much like what you want:
http://picssel.com/playground/jquery/fancyboxALAfacebook_26Mar12.html

Change the custom text ( Comment · Like· Share) when posted on profile page using facebook share functionality

I have a facebook iframe application with share functionality. Currently when i share something its showing the custom text Comment · Like· Share when posted on profile page.
I want to give customized text like view result etc.
How can i achieve this please guide me ?
I am using the code
<script>function fbs_click() {u='<?php echo $shareURL;?>';t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; height:15px; border:1px solid #d8dfea; background:url(http://b.static.ak.fbcdn.net/rsrc.php/z … 8q506x.gif) no-repeat top right; } html .fb_share_button:hover { color:#b5b8d3; border-color:#295582; background:#3b5998 url(http://b.static.ak.fbcdn.net/rsrc.php/z … 8q506x.gif) no-repeat top right; text-decoration:none; } </style> Share
Thanks
If you're using Facebook's dialogs you can specify custom action links with your posts, but if you're using the old sharer.php this isn't possible.